package com.jxw.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioButton;
import com.jxw.launcher.R;
import java.util.List;

/* loaded from: classes.dex */
public class SubjectAdapter extends RecyclerView.Adapter<ViewHolder> {
    private int choosePosition = 0;
    private int color;
    private int color2;
    private Context context;
    private List<String> data;
    boolean is;
    private int layoutItem;
    private RadiaoOnItemClickListener listener;

    /* loaded from: classes.dex */
    public interface RadiaoOnItemClickListener {
        void onSelectClick(int i);
    }

    public SubjectAdapter(Context context, List<String> list, int i, int i2, int i3) {
        this.context = context;
        this.data = list;
        this.layoutItem = i;
        this.color = i2;
        this.color2 = i3;
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ViewHolder(LayoutInflater.from(this.context).inflate(this.layoutItem, viewGroup, false));
    }

    public static int px2sp(Context context, float f) {
        return (int) ((f / context.getResources().getDisplayMetrics().scaledDensity) + 0.5f);
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public void onBindViewHolder(ViewHolder viewHolder, final int i) {
        viewHolder.subjectName.setText(this.data.get(i));
        if (this.choosePosition == i) {
            viewHolder.lineImg.setVisibility(8);
            viewHolder.subjectName.setChecked(true);
            RadioButton radioButton = viewHolder.subjectName;
            Context context = this.context;
            radioButton.setTextSize(px2sp(context, context.getResources().getDimension(R.dimen.y20)));
            viewHolder.subjectName.getPaint().setFakeBoldText(true);
            viewHolder.subjectName.setAlpha(1.0f);
            viewHolder.subjectName.setTextColor(this.context.getResources().getColor(R.color.white));
        } else {
            viewHolder.lineImg.setVisibility(8);
            viewHolder.subjectName.setChecked(false);
            RadioButton radioButton2 = viewHolder.subjectName;
            Context context2 = this.context;
            radioButton2.setTextSize(px2sp(context2, context2.getResources().getDimension(R.dimen.y16)));
            viewHolder.subjectName.getPaint().setFakeBoldText(true);
            viewHolder.subjectName.setAlpha(0.5f);
            viewHolder.subjectName.setTextColor(this.context.getResources().getColor(R.color.white));
        }
        viewHolder.subjectName.setOnClickListener(new View.OnClickListener() { // from class: com.jxw.adapter.SubjectAdapter.1
            @Override // android.view.View.OnClickListener
            public void onClick(View view) {
                if (SubjectAdapter.this.listener != null) {
                    SubjectAdapter.this.listener.onSelectClick(i);
                }
            }
        });
    }

    public void setChoosePosition(int i) {
        this.choosePosition = i;
        notifyDataSetChanged();
    }

    @Override // android.support.v7.widget.RecyclerView.Adapter
    public int getItemCount() {
        return this.data.size();
    }

    /* loaded from: classes.dex */
    public class ViewHolder extends RecyclerView.ViewHolder {
        private View lineImg;
        private RadioButton subjectName;
        private ImageView title;

        public ViewHolder(View view) {
            super(view);
            this.subjectName = (RadioButton) view.findViewById(R.id.subject_text);
            this.lineImg = view.findViewById(R.id.subject_line);
            this.title = (ImageView) view.findViewById(R.id.title);
        }
    }

    public void setData(List<String> list) {
        this.data = list;
        notifyDataSetChanged();
    }

    public void setOnItemClickListener(RadiaoOnItemClickListener radiaoOnItemClickListener) {
        this.listener = radiaoOnItemClickListener;
    }

    public void setbackage(boolean z) {
        this.is = z;
        notifyDataSetChanged();
    }
}
